Method of revising NC program for four-axis lathes

ABSTRACT

In checking tool rests for interference, interpolative simulations are executed by interpolation simulators (103, 104) one block at a time in successive fashion based on first and second NC programs (101, 102). In a case where the tool rests interfere with each other, the interpolative simulations are halted and both tool rests are moved backward to the beginning of the blocks in which the interference occurred. Thereafter, with the interpolative simulation based on one NC program being kept in the halted state, the interpolative simulation based on the other NC program is executed to move the other tool rest separately along a path in the interfering block. If interference does not occur during this separate movement, sequence numbers N, M of the firt and second NC programs in the blocks in which the interference occurred are stored in a storage area (301a). Thereafter, a similar interference check is performed. After the interference check, the first and second NC programs 101, 201 are revised by inserting a wait command ahead of the block of sequence number M in the NC program for which the interpolative simulation was halted, and inserting a wait command after the block of sequence number N in the NC program for which the interpolative simulation was executed.

BACKGROUND OF THE INVENTION

1. Technical Field

This invention relates to a method of revising NC programs for afour-axis lathe having two tool rests. More particularly, the inventionrelates to an NC program revision method in which, if the tool rests aregoing to interfere with each other, the NC programs are revised in sucha manner that the interference will not occur.

2. Background Art

An NC four-axis lathe is provided with first and second NC programshaving wait commands corresponding to respective ones of first andsecond tool rests. While synchronization is achieved by the waitcommands, movement of the corresponding tool rests is controlledindependently by the first and second NC programs to subject a workpieceto machining.

FIG. 5 shows an example of first and second NC programs 1, 2 in an NCfour-axis lathe. The programs respectively include program numbers 1a,2a, program portions 1b, 2b for executing a first machining operation,first wait commands 1c, 2c, program portions 1d, 2d for executing asecond machining operation, second wait commands 1e, 2e, programportions 1f, 2f for executing a third machining operation, third waitcommands 1g, 2g, program portions 1h, 2h for executing a fourthmachining operation, fourth wait commands 1i, 2i, program portions 1j,2j for executing a fifth machining operation, and tape end commands 1k,2k.

In accordance with the first and second NC programs 1, 2, the first andsecond tool rests machine a workpiece simultaneously (simultaneousindependent operation) according to the program portions 1b, 2b, and, inresponse to the first wait command "M100", the tool rest which finishesthe machining operation first waits until the other NC controller readsin the first wait command "M100".

When the other NC controller reads in "M100", the simultaneousindependent operation is performed according to the program portions 1d,2d. In response to the second wait command "M200", the tool rest whichfinishes the machining operation first waits until the other NCcontroller reads in the second wait command "M200".

When the other NC controller reads in "M200", the simultaneousindependent operation is performed according to the program portions 1f,2f. Note that since the program portion 1f is blank, the first tool restimmediately assumes a waiting state in response to the third waitcommand "M300", and only the second tool rest performs machiningaccording to the program portion 2f.

When machining by the second tool rest ends and the third wait command"M300" is read in, the simultaneous independent operation starts inaccordance with the program portions 1h, 2h. Thereafter, this four-axislathe control is performed in a similar manner, with simultaneousfour-axis machining being ended in response to the tape end commandsM30.

Thus, with a four-axis lathe having two tool rests, the tool rests canbe controlled and moved independently. Such a lathe is advantageous inthat e.g. the outer diameter of a workpiece 13 (see FIG. 6) can be cutby a tool 12 mounted on one tool rest 11 and the inner diameter of theworkpiece can be cut by a tool 22 mounted on the other tool rest 21.This enables machining time to be curtailed.

However, in a case where the two tool rests 11, 21 carry out machiningsimultaneously, a situation can arise, due to a program command error,in which the two tool rests (inclusive of their tools) collide. Sincesuch a collision must be avoided at all costs, the conventional practiceis to check prior to actual machining whether or not the two tool restswill collide (this is referred to as an "interference check"), andrevising the first and second NC programs corresponding to the toolrests if a collision occurs.

The interference check for determining whether the two tool rests willcoolide is performed as follows in the prior art:

As shown by the dashed lines in FIGS. 7(A) and 7(B) the shapes of thetools 12, 22 and tool rests 11, 21 are defined (approximated) asrectangular regions, whether these two rectangles will overlap ischecked, and it is deemed that interference will take place ifoverlapping occurs. This operation is performed with regard to all toolsmounted on the tool rests. The only reason for thus defining the shapesas rectangles is that checking for the overlapping of rectanglesinvolves comparatively simple calculations. Preferably, figuresconforming to the actual shapes should be checked for overlapping, butthis is not realistic due to the complicated calculations involved.Recently, however, it has become possible to input a figure conformingto actual shape into an NC unit with regard to every tool, and to checkthee figures for overlapping. In other words, since a CRT capable ofdisplaying color graphics may now be installed in an NC unit, each toolis displayed in a separate color and an interference check can readilybe formed based on whether or not the two color displays overlap.

If tool interference is going to occur, the NC programs must be revisedin such a manner that the interference will not be allowed to happen. Inthe prior art, however, an NC program cannot be revised automatically.As a result, the revision operation is a troublesome one and requires anextended period of time.

SUMMARY OF THE INVENTION

Accordingly, an object of the present invention is to provide an NCprogram revision method through which NC programs for a four-axis lathecan be revised automatically in such a manner that interference will notoccur.

Revision of NC programs for a four-axis lathe according to the presentinvention is performed in the following manner: In an interferencecheck, interpolative simulations are executed one block at a time insuccessive fashion based on first and second NC programs. Ifinterference occurs, the interpolative simulations are halted and bothtool rests are moved backward to the beginning of the blocks in whichthe interference occurred.

Thereafter, with the interpolative simulation based on one NC programbeing kept in the halted state, the interpolative simulation based onthe other NC program is executed to move the other tool rest separatelyalong a path in the interfering block. If interference does not occurduring this separate movement, sequence numbers N, M of the first andsecond NC programs in the aforementioned blocks in which theinterference occurred are stored. Thereafter, and in a similar manner,the interpolative simulations are resumed based on the first and secondNC programs.

After the interference check, the NC programs are revised by inserting await command ahead of the block of sequence number M in the NC programfor which the interpolative simulation was halted, and inserting a waitcommand after the block of sequence number N in the NC program for whichthe interpolative simulation was executed.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a functional block diagram of the present invention;

FIG. 2 is a block diagram of a graphic display unit for performing aninterference check;

FIG. 3 is a flowchart of processing according to the invention;

FIG. 4 is a diagram for describing program revision in case ofinterference;

FIG. 5 is a diagram of an example of NC programs for a four-axis lathe;

FIG. 6 is a diagram for describing a four-axis lathe; and

FIGS. 7(A) and 7(B) are diagrams for describing an interference check.

DESCRIPTION OF THE PREFERRED EMBODIMENT

FIG. 1 is a bench diagram for describing the present invention. Numerals101, 201 respectively denote first and second NC programs provided forcorresponding first and second tool rests. Numeral 301 denotes acomputerized NC unit, and number 401 represents a graphic display unitequipped with an interference check function.

Numerals 102, 202 denote decoding/execution data creation units forreading and decoding the NC programs one block at a time and forcreating execution-format data. Numerals 103, 203 representinterpolation simulators, and numerals 104, 204 designate storage areaseach of which stores the latest path data of a plurality of blocks alongwith the block numbers (sequence numbers). Numeral 301a denotes aninterfering block storage area for storing the sequence numbers ofinterfering blocks. It should be noted that the elements numbered in the100's are for controlling the movement of the first tool rest, and theelements numbered in the 200's are for controlling the movement of thesecond tool rest.

The graphic display unit 401 displays two tools in different colors sothat overlapping of first and second tools may be distinguished. Forexample, if the first tool rest and its tool are painted on the displayin blue and the second tool rest and its tool are painted in green, thenoverlapping of the two tools is deemed to occur when a "1" is read outof a frame memory (video RAM) for blue and a video RAM for greensimultaneously.

FIG. 2 is a block diagram of the graphic display unit 401. Numeral 41denotes a display processor, 42a-42c represent RAMs for blue, green andred beams, respectively, numerals 43a-43c denote read controllers, 44 aluminance control circuit, 45 a CRT and 46 an interference checkcircuit.

When the display processor 41 receives an input of interpolation datafrom the NC unit, the stored positions of the first and second toolrests (the painted pictures thereof) in the video RAMs 42a, 42b aremoved on the basis of the interpolation data. It should be noted that apicture of the stationary portion of the machinery is stored in thevideo RAM 42c. Meanwhile, the read controllers 43a-43c read the picturesout of the video RAMs 42a-42c and apply them to the luminance controlcircuit 44 in synchronism with the raster scanning of the CRT. On thebasis of the picture data read out of the video RAMs, the luminancecontrol circuit subjects the blue, green and red grids to luminancecontrol and paints the pictures of the tool rests and the stationaryportion of the machinery on the CRT 45.

In concurrence with the foregoing, the interference check circuit 46checks whether "1" has been read out of the video RAMs 42a, 42bsimultaneously. If this is the case, it is construed that the tool restswill interfere with each other; hence, an interference signal IFS isoutputted by the interference check circuit.

FIG. 3 is a processing flowchart illustrating a method of revising NCprograms for a four-axis lathe according to the present invention. Theoverall operation of FIG. 1 will now be described in accordance withthis flowchart.

(1) When the interference check is started by operating a switch on anoperator's panel (not shown), the NC programs of the respective toolrests are read, decoded and converted into execution-format data oneblock at a time by the decoding/execution data creating units 102, 202.In the interference check, the tool rests are mechanically locked so asnot to move. The tools rests move only on the screen of the CRT.

If an item of NC data is indicative of program end MO2 or tape end M30,the interference check processing is ended and revision processing,described below, is executed.

(2) The execution format data are stored in the storage areas 104, 204,which are referred to as a program data memory. Sequence numbers arealso stored in these storage areas together with the execution formatdata.

(3) The interpolation simulators 103, 203 execute interpolativesimulation using the execution format data, and the results aredelivered to the graphic display unit 401.

(4) On the basis of the interpolated data, the graphic display unit 401moves the stored positions of the tools in the video RAMs and displaysthis. In addition, the graphic display unit checks whether the two toolsinterfere with each other.

(5) If the tools do not interfere with each other, a check is performedto determine if one block of an interpolative simulation has ended. Ifit has not ended, processing is executed from step (3) onward; if ithas, processing is repeated from step (1) onward based on the next blockof NC data.

(6) If the tools interfere with each other in step (4), theinterpolation simulators 103, 203 stop interpolating. Let N representthe sequence number of the first NC program at the moment ofinterference, and let M represent the sequence number of the second NCprogram at the moment of interference.

Thereafter, the two tool rests are moved backward to the startingpositions of the interfering blocks using the respective tool positionsthat prevailed when interpolation was stopped and the starting positionsof the interfering blocks (these positions having been stored in thestorage areas 104, 204).

(7) When the backward movement is completed, only the interpolationsimulator 103 (or the interpolation simulator 203) performs aninterpolative simulation based on path data in the interfering block,whereby solely the the first tool rest is moved along the path of theinterfering block.

(8) The graphic display unit 401 checks whether interference occurs withregard to this movement solely of the first tool rest.

(9) If interference does not occur, it is checked whether this solemovement along the path of the interfering block is completed. If thesole movement is not completed, processing is resumed from step (7)onward.

(10) If the movement solely of the first tool rest is completed withoutthe occurrence of interference, then N, M are stored in the interferingblock storage area 301a, after which simultaneous movement control isresumed. Note that the first tool rest is subjected to path controlbased on the next item of NC data, and that the second tool rest issubjected to path control based on the latest path data stored in thestorage area 204.

(11) If interference occurs at step (8), then the operation I+1→I isperformed (where I is the number of time interference occurs and iscleared to zero by a wait command).

(12) A check is performed to determine whether I≧I_(s) holds, whereI_(s) represents the number of times interference is allowed to occurfrom one wait command to the next.

(13) If I≧I_(s) holds, control of the four-axis lathe by the first andsecond NC programs is construed to be unsuitable, a display is made tothis effect and processing is ended.

(14) If I<I_(s) holds, the operations N-1→N, M-1→M are performed,whereby the blocks that are one block before the blocks in which theinterference actually occurred are regarded as the interfering blocks.This is followed by repeating processing from block (6) onward.

When the interference check is thus completed, processing for revisingthe first and second NC programs is executed using the sequence numbersstored in the interfering block storage area 301a. Specifically, the NCprograms are revised by:

(a) inserting a wait command ahead of the block whose sequence number isM in the second NC program for which interpolative simulation wasstopped.

(b) inserting a wait command after the block whose sequence number is Nin the NC program for which interpolative simulation was executed.

For example, assume that the first and second NC programs are asfollows:

    ______________________________________                                        First NC Program    Second NC Program                                         ______________________________________                                        N1100M100;          N2100M100;                                                N1101G00X --Z --S --M03;                                                                          N2101G00X --Z --;                                         N1102G01X --F --;   N2102G01Z --F --;                                         N1103G00Z --;       N2103G00X --;                                             N1104X --;          N2104Z --;                                                N1105G01Z --;       N2105G01X --;                                             N1106X --;          N2106Z --;                                                N1200M200;          N2200M200;                                                ______________________________________                                    

(where M100, M200 are wait commands). Further, assume that interferenceoccurs with regard to movement associated with sequence N1102 of thefirst NC program and sequence number N2102 of the second NC program, asshown in FIG. 4. In such case, N=1102, M=2102 (where it is assumed thatinterference does not occur when only one tool rest is moved), and thefirst and second NC programs are revised as follows:

    ______________________________________                                        First NC Program    Second NC Program                                         ______________________________________                                        N1100M100;          N2100M100;                                                N1101G00X --Z --S --M03;                                                                          N2101G00X --Z --;                                         N1102G01X --F --;   N2102M300;                                                N1103M300           N2103G01Z --F --;                                         N1104G00Z --;       N2104G00X --;                                             N1105X --;          N2105Z --;                                                N1106G01Z --;       N2106G01X --;                                             N1107X --;          N2107Z --;                                                N1200M200;          N2200M200;                                                ______________________________________                                    

In the foregoing case, sole movement of one tool rest upon completion ofbackward movement is performed by one of the NC programs decided inadvance unconditionally. However, which of the interpolative simulationsis to be executed can be decided upon taking into consideration the typeof machining performed by the tool rests. For example, the NC programfor which the interpolative simulation is halted may be decided uponconsidering a requirement that inner diameter cutting is to havepriority over end face cutting and outer diameter cutting.

Thus, according to the invention, when it is found that interferencewill occur in a tool rest interference check, the NC programs for thefour-axis lathe can be revised automatically in such a manner that theinterference will not take place. This makes it possible to executerevision processing simply in a short period of time.

What is claimed is:
 1. A method of revising NC programs for a four-axislathe in which there are provided first and second NC programscorresponding to first and second tool rests, respectively, the firstand second NC programs each having wait commands, wherein a workpiece ismachined by controlling movement of the first and second tool restsindependently in accordance with the first and second NC programs,respectively, while synchronization is achieved by the wait commands,said method comprising the steps of:(a) executing interpolativesimulations one block at a time in successive fashion based on the firstand second NC programs when an interference check is made; (b) checkingwhether tools on the first and second tool rests interfere with eachother during said step (a); (c) when it is determined in said step (b)that there is interference, halting the interpolative simulations andmoving the two tool rests back to the beginning of blocks in which theinterference occurred; (d) holding the interpolative simulationaccording to one of the first and second NC programs in the halted stateand executing the interpolative simulation according to the other of thefirst and second NC programs to move solely the corresponding tool restalong a path in the block in which the interference occurred whilechecking for interference; (e) when no interference is found when movingsolely the one tool rest in said step (d), storing sequence numbers ofthe first and second programs which prevailed when interferenceoccurred; and (f) automatically revising the NC programs after theinterference check by inserting a wait command ahead of the sequencenumber of the NC program for which the interpolative simulation washalted in said step (d), and inserting a wait command after the sequencenumber of the NC program for which the interpolative simulation wasexecuted in said step (d).
 2. A method of revising NC programs for afour-axis lathe according to claim 1, further comprising the step ofinputting interpolation data obtained by the interpolative simulationsto a graphic display unit, wherein the graphic display unit performs theinterference check of said step (b).
 3. A method of revising NC programsfor a four-axis lathe according to claim 2, wherein said step (b)includes displaying each of the tool rests based on picture data storedin separate video RAMs by reading the picture data out of both videoRAMs in synchronism with raster scanning of a CRT, and rendering adecision to the effect that of the tool rests will interfere with eachother when both items of the picture data attain a high levelsimultaneously.
 4. A method of revising NC programs for a four-axislathe according to claim 1, wherein said step (a) comprises storingseveral items of latest NC data in the first and second NC programs forwhich the interpolative simulations are executed in a memory, andwherein said step (c) comprises reading out starting positions of theblocks in which interference occurred from the memory and moving both ofthe tool rests back to the starting points of the blocks.
 5. A method ofrevising NC programs for a four-axis lathe according to claim 1, furthercomprising a step (g) which is executed when interference occurs whenmoving solely one tool rest in said step (d), said step (g) comprisingregarding blocks that are one block before the blocks in which theinterference occurred as the interfering blocks, moving both tool reststo starting points of the blocks that are one block before the blocks inwhich the interference occurred, and thereafter controlling the movementsolely of the one tool rest in accordance with said step (d).
 6. Amethod of preventing interference between tools in an NC machine toolcontrolled by first and second NC programs which control the movement offirst and second tool rests, respectively, to machine a workpiece,comprising the steps of:(a) reading the first and second NC programs oneblock at a time in successive fashion and executing interpolativesimulations on the first and second NC programs while displaying thefirst and second tool rests; (b) determining whether the tools on thefirst and second tool rests interfere with each other during theinterpolative simulations executed in said step (a); (c) suspendingexecution of the interpolative simulations of said step (a) when it isdetermined in said step (b) that there is interference between thetools, and returning the displayed first and second tool rests to aposition corresponding to the beginning of the blocks of the first andsecond programs in which interference occurred; (d) executinginterpolative simulation according to one of the first and second NCprograms to move the display of the first tool rest in accordance withthe corresponding block of the first NC program, while maintaining theinterpolative simulation according to the second NC program in asuspended state; (e) determining whether the tools on the first andsecond tool rests interfere with each other during said step (d); (f)storing sequence numbers corresponding to the blocks of the first andsecond programs in which the interference occurred in said step (b) whenit is determined that there is no interference in said step (e); (g)returning to said step (a) after said step (f) has been completed; and(h) automatically revising the first and second NC programs afterinterpolative simulation has been executed for all of the first andsecond NC programs, by inserting a wait command in front and each blockof the second NC program having a stored sequence number correspondingto the second NC program being suspended in said step (d), and insertinga wait command after each block of the first NC program corresponding toa stored sequence number for the first NC program for whichinterpolative simulation was executed in said step (d).
 7. A methodaccording to claim 6, wherein said step (a) includes displaying each ofthe first and second tool rests in different colors.
 8. A method ofrevising NC programs for a four-axis lathe in which there are providedfirst and second NC programs corresponding to first and second toolsrests, respectively, the first and second NC programs each having waitcommands, wherein a workpiece is machined by controlling movement of thefirst and second tool rests independently in accordance with the firstand second NC programs, respectively, while synchronization is achievedby the wait commands, said method comprising the steps of:(a) executinginterpolative simulations one block at a time in successive fashionbased on the first and second NC programs when an interference check ismade, said step (a) including storing several items of latest NC data inthe first and second NC programs for which the interpolative simulationsare executed in a memory; (b) checking whether tools on the first andsecond tool rests interfere with each other during said step (a); (c)when it is determined in said step (b) that there is interference,halting the interpolative simulations and moving the tool rests back tothe beginning of blocks in which the interference occurred, said step(c) including reading out starting positions of the blocks in whichinterference occurred from the memory and moving both of the tool restsback to the starting points of the blocks; (d) holding the interpolativesimulation according to one of the first and second NC programs in thehalted state and executing the interpolative simulation according to theother of the first and second NC programs to move solely thecorresponding tool rest along a path in the block in which theinterference occurred while checking for interference; (e) when nointerference is found when moving solely the one tool rest in said step(d), storing sequence numbers of the first and second programs whichprevailed when interference occurred; and (f) revising the NC programsafter the interference check by inserting a wait command ahead of thesequence number of the NC program for which the interpolative simulationwas halted in said step (d), and inserting a wait command after thesequence number of the NC program for which the interpolative simulationwas executed in said step (d).